<%@ tag pageEncoding="UTF-8"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="params" scope="request"><jsp:doBody/></c:set>
<c:set var="params" value="${fn:split(params,',')}"/>
<c:set var="pageSize" value="${1*params[0]}"/>
<c:set var="total" value="${1*params[1]+1}"/>
<c:set var="topicId" value="${params[2]}"/>

<c:set var="pageTotal">${(total+pageSize-1)/pageSize}</c:set>
<c:set var="pageTotal" value="${fn:substring(pageTotal,0,fn:indexOf(pageTotal,'.'))}"/>

<c:if test="${pageTotal>1}">
...
<c:if test="${pageTotal<=4}">
<c:forEach var="n" begin="2" end="${pageTotal}">
 <a href="${BBSROOT}/topic-${topicId}-${n}.html" target="_blank">${n}</a>
</c:forEach>
</c:if>
<c:if test="${pageTotal>4}">
${pageTotal}
<c:forEach var="n" begin="2" end="4">
 <a href="${BBSROOT}/topic-${topicId}-${n}.html" target="_blank">${n}</a>
</c:forEach>
...
<a href="${BBSROOT}/topic-${topicId}-${pageTotal}.html" target="_blank">${pageTotal}</a>
</c:if>
</c:if>



 